package repeat3;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hua YY
 * Date: 2024-10-11
 * Time: 11:38
 */
public class UdpDictionaryServer extends UdpEchoServer{
    private HashMap<String,String> hashMap = new HashMap<>();
    public UdpDictionaryServer(int port) throws SocketException {
        super(port);

        hashMap.put("阿猫","cat");
        hashMap.put("阿狗","dog");
        hashMap.put("张三","李四");

    }
    @Override
    public String process(String request){
        return hashMap.getOrDefault(request,"你查的单词不存在");
    }

    public static void main(String[] args) throws IOException {
        UdpDictionaryServer server = new UdpDictionaryServer(9096);
        server.start();
    }
}
